package com.sino.operation.autoCompareNode;

import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.sino.operation.Exception.sinoexception.TerminalTaskException;
import com.sino.operation.autoCompareNode.common.DrawMethod;
import com.sino.operation.commons.ConstantValue;
import com.sino.operation.commons.commonEnum.*;
import com.sino.operation.commons.response.CenterResponseEnum;
import com.sino.operation.commons.util.Exec_Util;
import com.sino.operation.entity.*;
import com.sino.operation.entity.entityBasic.Register;
import com.sino.operation.param.out.EscReciveByCounter;
import com.sino.operation.service.impl.*;
import com.sino.operation.util.TaskTerminalUtil;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.lang.reflect.Method;
import java.text.SimpleDateFormat;
import java.util.*;

/**
 * @Title: AutoCompareService
 * @Description: 自动服务比对节点
 * @Author dengls
 * @date 2021/9/17 11:15
 */
@Slf4j
@Service
public class AutoCompareService {

    @Autowired
    private SysAbMessageServiceImpl abMessageService;
    @Autowired
    private AutoCheckServiceImpl autoCheckService;
    @Autowired
    private BizExchangeInfoServiceImpl exchangeInfoService;
    @Autowired
    private BizInternalTransServiceImpl internalTransService;
    @Autowired
    private BizMarginOpenAccountServiceImpl marginOpenAccountService;
    @Autowired
    private BizDespositInfoServiceImpl despositInfoService;
    @Autowired
    private TaskTerminalUtil taskTerminalUtil;


    /*网点岗报文*/
    private Map<String, Object> netPositionMap = null;
    /*中心岗报文*/
    private Map<String, Object> centerPositionMap = null;
    /*工作流id，暂定，也可能是工作流对象*/
    private String workflowNumber = "";
    /*流水号*/
    private String journalNo = "";
    /*单条记录所有岗位报文*/
    private SysAbMessage abMessage = null;
    /*登记薄*/
    private Register register = null;
    /*自动节点规则*/
    private List<AutoCheck> autoCheckConfigList = null;

    private AutoCompareService() {
    }

    /**
     * 获取自动比对结果
     *
     * @param transCode      交易类型
     * @param journalNo      流水号
     * @param workflowNumber 工作流id
     * @param <T>
     * @return
     */
    public <T extends Register> AutoCompareEntity getAutoCompareResult(String transCode, String journalNo, String workflowNumber) {
        this.autoCheckConfigList = this.handlerAutoCheckConfigList(transCode);//自动节点配置信息
//        this.transList = bizTransListService.getById(journalNo);//流水表
        this.abMessage = abMessageService.getById(journalNo);//ab报文表
        this.workflowNumber = workflowNumber;//工作流id
        this.register = this.getRegister(transCode, journalNo);//登记薄
        this.journalNo = journalNo;
        if (abMessage.getMessageAccept() != null) {
            try {
                String messageAccept = abMessage.getMessageAccept();
                EscReciveByCounter escReciveByCounter = JSONObject.parseObject(messageAccept, EscReciveByCounter.class);
                Object message = escReciveByCounter.getEscBody().getObject();
                this.netPositionMap = (Map) JSON.parse(JSONObject.toJSONString(message));
            } catch (Exception e) {
                String str = "自动节点比对，网点岗报文异常，请排查数据库，具体异常：" + e.getMessage();
                log.info(str);
                return AutoCompareEntity.error(str);
            }
        } else {
            this.netPositionMap = new HashMap<>();
        }
        if (abMessage.getMessage() != null) {
            try {
                String messageAccept = abMessage.getMessage();
                EscReciveByCounter escReciveByCounter = JSONObject.parseObject(messageAccept, EscReciveByCounter.class);
                Object message = escReciveByCounter.getEscBody().getObject();
                this.centerPositionMap = (Map) JSON.parse(JSONObject.toJSONString(message));
            } catch (Exception e) {
                String str = "自动节点比对，中心岗报文异常，请排查数据库，具体异常：" + e.getMessage();
                log.info(str);
                return AutoCompareEntity.error(str);
            }
        } else {
            this.centerPositionMap = new HashMap<>();
        }
        //需要校验的所有规则
        List<AutoCheckConfigEntity> needCompareData = new ArrayList<>();
        try {
            this.autoCheckConfigList.forEach(item -> {
                //将数据库中需要校验的数据从json转为map key 网点 value 中心
                Map<String, Object> needCompareFields = (Map) JSON.parse(item.getParameter());
                AutoCheckConfigEntity autoCheckConfigEntity = new AutoCheckConfigEntity(item.getId(), item.getTransCode(), item.getCheckCode(), item.getCheckName(), needCompareFields, item.getMethodName(), item.getFailReason(), item.getNodeLog());
                needCompareData.add(autoCheckConfigEntity);
            });
        } catch (Exception e) {
            String str = "自动节点比对，转化自动校验数据异常，请排查数据库，具体异常：" + e.getMessage();
            log.info(str);
            return AutoCompareEntity.error(str);
        }
        for (int i = 0; i < needCompareData.size(); i++) {
            String methodName = needCompareData.get(i).getMethodName();
            Map<String, Object> needCompareFields = needCompareData.get(i).getParameter();
            AutoCompareEntity autoCompareEntity = null;
            String failReason = needCompareData.get(i).getFailReason();
            String nodeLog = needCompareData.get(i).getNodeLog();
            try {
                Method method = this.getClass().getDeclaredMethod(methodName, Map.class, String.class, String.class);
                autoCompareEntity = (AutoCompareEntity) method.invoke(this, needCompareFields, failReason, nodeLog);
            } catch (Exception e) {
                String str = "自动节点比对，动态调用" + methodName + "方法异常，具体异常：" + e.getMessage();
                log.info(str);
                return AutoCompareEntity.error(str);
            }
            if (!autoCompareEntity.getFlag()) {
                log.info(autoCompareEntity.getFailReason());
                return autoCompareEntity;
            }
        }
        return AutoCompareEntity.ok();
    }

    /**
     * 基础比对，仅校验key,value的值是否相等
     *
     * @param needCompareFields
     * @return
     */
    private AutoCompareEntity compareBasicEquals(Map<String, String> needCompareFields, String failReason, String nodeLog) {
        for (Map.Entry<String, String> entry : needCompareFields.entrySet()) {
            String netValue = netPositionMap.containsKey(entry.getKey()) ? (String) netPositionMap.get(entry.getKey()) : "";
            String centerValue = centerPositionMap.containsKey(entry.getValue()) ? (String) centerPositionMap.get(entry.getValue()) : "";
            if (!netValue.equals(centerValue)) {
                terminate(workflowNumber, failReason, nodeLog);
                return AutoCompareEntity.error(failReason);
            }
        }
        return AutoCompareEntity.ok();
    }

    /**
     * 保证金开户、通知存款
     * 系统来源为待销账时候，对比账户金额
     *
     * @param needCompareFields
     * @return
     */
    private AutoCompareEntity compareAmount(Map<String, String> needCompareFields, String failReason, String nodeLog) {
        String source = netPositionMap.containsKey("SOURCE") ? (String) netPositionMap.get("SOURCE") : "";
        if (SystemSource.PENDING_WRITE_OFF.getValue().equals(source)) {
            //当系统来源为待销账的时候
            return compareBasicEquals(needCompareFields, failReason, nodeLog);
        }
        return AutoCompareEntity.ok();
    }


    /**
     * 保证金开户
     * 当保证金类型为定期，比较网点与中心录入的期限
     *
     * @param needCompareFields
     * @return
     */
    private AutoCompareEntity compareCashDepositTimeLimit(Map<String, String> needCompareFields, String failReason, String nodeLog) {
        String bzjlx = netPositionMap.containsKey("BOND_TYPE") ? (String) netPositionMap.get("BOND_TYPE") : "";
        if (MarginType.REGULAR1.getValue().equals(bzjlx) || MarginType.REGULAR2.getValue().equals(bzjlx)) {
            //保证金类型为定期，比较网点与中心录入的期限
            return compareBasicEquals(needCompareFields, failReason, nodeLog);
        }
        return AutoCompareEntity.ok();
    }

    /**
     * 保证金开户
     * 校验开户行名称是否错误
     *
     * @param needCompareFields
     * @return
     */
    private AutoCompareEntity cashDepositCheckBankName(Map<String, String> needCompareFields, String failReason, String nodeLog) {
        String cps_flag = "";
        //这里错了，这里是保证金开户的登记簿,这里没有实体，暂时这么设置。
        if (register instanceof BizMarginOpenAccount) {
            cps_flag = ((BizMarginOpenAccount) register).getCpsFlag();
        }
        String source = netPositionMap.containsKey("SOURCE") ? (String) netPositionMap.get("SOURCE") : "";
        if (AspectFlag.AspectFlag1.getValue().equals(cps_flag)) {
            //切片
            boolean hasBankName = false;
            String bzj_khyh = centerPositionMap.containsKey("BZJ_TZS_KHYH") ? (String) centerPositionMap.get("BZJ_TZS_KHYH") : "";//保证金通知书开户银行
            if (checkDepositBankName(bzj_khyh)) {
                String certy = netPositionMap.containsKey("CERTY") ? (String) netPositionMap.get("CERTY") : "";//凭证种类
                if (VoucherType.VOUCHERTYPE01.getValue().equals(certy) || VoucherType.VOUCHERTYPE38.getValue().equals(certy)) {
                    //转账支票
                    String zzzp_fkrmc = centerPositionMap.containsKey("BZJ_ZZZP_FKHMC") ? (String) centerPositionMap.get("BZJ_ZZZP_FKHMC") : "";//转账支票付款行名称
                    String jzd_skhh = centerPositionMap.containsKey("BZJ_JZD_SKHH") ? (String) centerPositionMap.get("BZJ_JZD_SKHH") : "";//进账单付款人开户行
                    String jzd_ckhh = centerPositionMap.containsKey("BZJ_JZD_CKHH") ? (String) centerPositionMap.get("BZJ_JZD_CKHH") : "";//转账支票记账单名称
                    if (checkDepositBankName(zzzp_fkrmc) && checkDepositBankName(jzd_skhh) && checkDepositBankName(jzd_ckhh)) {
                        hasBankName = true;
                    }
                } else if (VoucherType.VOUCHERTYPE71.getValue().equals(certy)) {
                    //特种转账支票
                    String tzzz_fkhh = centerPositionMap.containsKey("BZJ_TZZZ_FKHH") ? (String) centerPositionMap.get("BZJ_TZZZ_FKHH") : "";
                    String tzzz_skhh = centerPositionMap.containsKey("BZJ_TZZZ_SKHH") ? (String) centerPositionMap.get("BZJ_TZZZ_SKHH") : "";
                    if (checkDepositBankName(tzzz_fkhh) && checkDepositBankName(tzzz_skhh)) {
                        hasBankName = true;
                    }
                } else if (VoucherType.VOUCHERTYPE73.getValue().equals(certy)) {
                    //支款凭条
                    String zkpt_fkhh = centerPositionMap.containsKey("BZJ_ZKPT_FKHH") ? (String) centerPositionMap.get("BZJ_ZKPT_FKHH") : "";
                    String zkpt_skhh = centerPositionMap.containsKey("BZJ_ZKPT_SKHH") ? (String) centerPositionMap.get("BZJ_ZKPT_SKHH") : "";
                    if (checkDepositBankName(zkpt_fkhh) && checkDepositBankName(zkpt_skhh)) {
                        hasBankName = true;
                    }
                }
            }
            //如果不包含三峡银行 终止任务
            if (!hasBankName) {
                terminate(workflowNumber, failReason, nodeLog);
                return AutoCompareEntity.error(failReason);
            }
        } else if (AspectFlag.AspectFlag2.equals(cps_flag) && SystemSource.TRANSFER_ACCOUNTS.equals(source)) {
            //来源是整单并且是转账
            boolean hasBankName = false;
            String zd_fkhmc = centerPositionMap.containsKey("MAOP_ZD_FKRKHHMC") ? (String) centerPositionMap.get("MAOP_ZD_FKRKHHMC") : "";//付款人开户行名称
            String zd_skhmc = centerPositionMap.containsKey("MAOP_ZD_SKRKHHMC") ? (String) centerPositionMap.get("MAOP_ZD_SKRKHHMC") : "";//收款人开户行名称
            if (checkDepositBankName(zd_fkhmc) && checkDepositBankName(zd_skhmc)) {
                hasBankName = true;
            }
            //如果不包含三峡银行 终止任务
            if (!hasBankName) {
                terminate(workflowNumber, failReason, nodeLog);
                return AutoCompareEntity.error(failReason);
            }
        }
        return AutoCompareEntity.ok();
    }

    /**
     * 校验支取方式
     *
     * @param needCompareFields
     * @return
     */
    private AutoCompareEntity checkWithdrawalMethod(Map<String, String> needCompareFields, String failReason, String nodeLog) {
        String drawMethodResult = DrawMethod.drawMethod(netPositionMap, needCompareFields);
        if (!"pass".equals(drawMethodResult)) {
            String reason = drawMethodResult + failReason;
            terminate(workflowNumber, reason, nodeLog);
            return AutoCompareEntity.error(reason);
        }
        return AutoCompareEntity.ok();
    }

    /**
     * 保证金开户
     * 查询付款人&收款人 信息（这个业务逻辑有问题，待定）
     *
     * @param needCompareFields
     * @return
     */
    private AutoCompareEntity checkCashDepositPayerAndPayeeInfo(Map<String, String> needCompareFields, String failReason, String nodeLog) {
        String source = netPositionMap.containsKey("SOURCE") ? (String) netPositionMap.get("SOURCE") : "";
        String skrmc = centerPositionMap.containsKey("USER_NAME") ? (String) centerPositionMap.get("USER_NAME") : "";//收款人名称
        if (SystemSource.TRANSFER_ACCOUNTS.getValue().equals(source)) {
            //当系统来源为转账
//            String queryPayerResult = QueryPeyerMsgFromKernel.queryHNZZCCYFromKernel(skrmc,mocInfo, organId, fkrzh, fkrmc, "710305",acceptXml,tranPo);
            String queryPayerResult = "";
            if (!"pass".equals(queryPayerResult)) {
                String reason = queryPayerResult + "，系统自动终止";
                terminate(workflowNumber, reason, "校验收/付款人信息出错");
                return AutoCompareEntity.error(reason);
            }
            //具体实现逻辑待定
            return AutoCompareEntity.ok();
        } else {
            //当系统来源为待销账、现金
            String userName = netPositionMap.containsKey("USER_NAME") ? (String) netPositionMap.get("USER_NAME") : "";//客户名
            if (!skrmc.equals(userName)) {
                String reason = "收款人名称中心录入为：" + skrmc + " ，核心为：" + userName + "，比对不一致，系统自动终止";
                terminate(workflowNumber, reason, "收款人名称与核心不一致");
                return AutoCompareEntity.error(reason);
            }
        }
        return AutoCompareEntity.ok();
    }

    /**
     * 保证金开户
     * 日期合法校验
     *
     * @param needCompareFields
     * @return
     */
    private AutoCompareEntity cashDepositCheckDateLegal(Map<String, String> needCompareFields, String failReason, String nodeLog) {
        String reason = "";
        String source = netPositionMap.containsKey("SOURCE") ? (String) netPositionMap.get("SOURCE") : "";
        String cprq = centerPositionMap.containsKey("cprq") ? (String) centerPositionMap.get("cprq") : "";//出票日期
        //这里用register强向下转型为保证金登记薄类型，然后取出voucherType的值
        String voucherType = "";
        if (VoucherType.VOUCHERTYPE01.getValue().equals(voucherType) || VoucherType.VOUCHERTYPE38.getValue().equals(voucherType)) {
            //转账支票（清分机，非清分机），校验远期逾期
//            cprq = Exec_Util.translationForData(cprq, baseDao);调接口查，到时候具体在写业务
            cprq = "";
            if ("false".equals(cprq)) {
                reason = "大写日期录入出错，流程终止";
                terminate(workflowNumber, reason, "日期合法性检查出错");
                return AutoCompareEntity.error(reason);
            }
//            String dvRtnMsg = DateValidity.dateValidity(cprq, baseDao);调接口查，到时候具体在写业务
            String dvRtnMsg = "";
            if (!"pass".equals(dvRtnMsg)) {
                reason = dvRtnMsg + "，流程终止";
                terminate(workflowNumber, reason, "日期合法性检查出错");
                return AutoCompareEntity.error(reason);
            }
        } else if (VoucherType.VOUCHERTYPE71.getValue().equals(voucherType)) {
            //特种转账凭证与当前日期比较
            String currentDate = new SimpleDateFormat("yyyyMMdd").format(new Date());
            log.debug("【当前日期：" + currentDate + "】【出票日期：" + cprq + "】");
            if (!currentDate.equals(cprq)) {
                reason = "凭证日期不符，系统自动终止";
                terminate(workflowNumber, reason, "日期合法性检查出错");
                return AutoCompareEntity.error(reason);
            }
        }
        if (!SystemSource.TRANSFER_ACCOUNTS.getValue().equals(source)) {
            //待销账、现金任务，比较整单与网点岗录入的日期，不一致终止任务
            String currentDate = new SimpleDateFormat("yyyyMMdd").format(new Date());
            log.debug("【当前日期：" + currentDate + "】【出票日期：" + cprq + "】");
            if (!currentDate.equals(cprq)) {
                reason = "凭证日期不符，系统自动终止";
                terminate(workflowNumber, reason, "日期合法性检查出错");
                return AutoCompareEntity.error(reason);
            }
        }
        return AutoCompareEntity.ok();
    }

    /**
     * 保证金开户 定期存款、通知存款
     * 核心验密   在此过程中，核心会校验一次凭证是否远期逾期等
     *
     * @param needCompareFields
     * @param failReason
     * @param nodeLog
     * @return
     */
    private AutoCompareEntity checkCoreSecretInspection(Map<String, String> needCompareFields, String failReason, String nodeLog) {
        //支取方式,这里是从其他地方查出来的。
        String wdmd = "";
        String source = netPositionMap.containsKey("SOURCE") ? (String) netPositionMap.get("SOURCE") : "";
        if (SystemSource.TRANSFER_ACCOUNTS.getValue().equals(source)) {//转账
            if ("1".equals(wdmd)) {
//                map.put("fhdm", mocInfo.getAcct_branch_id());
//                String verifyPwdResult = VerifiPassword.verifiPassword(xml,acceptXml,(HashMap) map);
                String verifyPwdResult = "";
                if (!"pass".equals(verifyPwdResult)) {
                    String reason = verifyPwdResult + failReason;
                    terminate(workflowNumber, reason, nodeLog);
                    return AutoCompareEntity.error(reason);
                }
            }
        }
        return AutoCompareEntity.ok();
    }

    /**
     * 保证金开户 定期存款、通知存款
     * 设值优先级
     *
     * @param needCompareFields
     * @param failReason
     * @param nodeLog
     */
    private AutoCompareEntity setPriority(Map<String, String> needCompareFields, String failReason, String nodeLog) {
        //计算优先级
        //实例化优先
        return AutoCompareEntity.ok();
    }

    /**
     * 保证金开户
     * 业务判重
     *
     * @param needCompareFields
     * @param failReason
     * @param nodeLog
     * @return
     */
    private AutoCompareEntity cashDepositJudgmentRepetition(Map<String, String> needCompareFields, String failReason, String nodeLog) {
        //校验业务是否重复
        //重复发往网点确认
        return AutoCompareEntity.ok();
    }

    /*
     * 定期存款、通知存款
     * 当是切片时候，切片币种比对
     */
    private AutoCompareEntity compareDepositAtNoticeAspectBZ(Map<String, String> needCompareFields, String failReason, String nodeLog) {
        BizDespositInfo despositInfo = null;
        if (register instanceof BizDespositInfo) {
            despositInfo = (BizDespositInfo) register;
            String cps_flag = despositInfo.getCpsFlag();
            if (AspectFlag.AspectFlag1.getValue().equals(cps_flag)) {
                return compareBasicEquals(needCompareFields, failReason, nodeLog);
            }
        }
        return AutoCompareEntity.ok();
    }

    /**
     * 定期存款、通知存款
     * 校验开户行名称是否错误
     *
     * @param needCompareFields
     * @return
     */
    private AutoCompareEntity depositAtNoticeCheckBankName(Map<String, String> needCompareFields, String failReason, String nodeLog) {
        String cps_flag = "";
        //这里错了，这里是保证金开户的登记簿,这里没有实体，暂时这么设置。
        if (register instanceof BizDespositInfo) {
            cps_flag = ((BizDespositInfo) register).getCpsFlag();
        }
        String source = netPositionMap.containsKey("SOURCE") ? (String) netPositionMap.get("SOURCE") : "";
        if (AspectFlag.AspectFlag1.getValue().equals(cps_flag)) {
            //切片
            boolean hasBankName = false;
            String bzj_khyh = centerPositionMap.containsKey("BZJ_TZS_KHYH") ? (String) centerPositionMap.get("BZJ_TZS_KHYH") : "";//保证金通知书开户银行
            if (checkDepositBankName(bzj_khyh)) {
                String certy = netPositionMap.containsKey("CERTY") ? (String) netPositionMap.get("CERTY") : "";//凭证种类
                if (VoucherType.VOUCHERTYPE01.getValue().equals(certy) || VoucherType.VOUCHERTYPE38.getValue().equals(certy)) {
                    //转账支票
                    String zzzp_fkrmc = centerPositionMap.containsKey("DGDQ_ZZZP_FKRMC") ? (String) centerPositionMap.get("DGDQ_ZZZP_FKRMC") : "";//转账支票付款行名称
                    String jzd_skhh = centerPositionMap.containsKey("DGDQ_JZD_CPRKHYH") ? (String) centerPositionMap.get("DGDQ_JZD_CPRKHYH") : "";//进账单付款人开户行
                    String jzd_ckhh = centerPositionMap.containsKey("DGDQ_JZD_SKRKHYH") ? (String) centerPositionMap.get("DGDQ_JZD_SKRKHYH") : "";//转账支票记账单名称
                    if (checkDepositBankName(zzzp_fkrmc) && checkDepositBankName(jzd_skhh) && checkDepositBankName(jzd_ckhh)) {
                        hasBankName = true;
                    }
                } else if (VoucherType.VOUCHERTYPE71.getValue().equals(certy)) {
                    //特种转账支票
                    String tzzz_fkhh = centerPositionMap.containsKey("DGDQ_TTZZ_FKRKHH") ? (String) centerPositionMap.get("DGDQ_TTZZ_FKRKHH") : "";
                    String tzzz_skhh = centerPositionMap.containsKey("DGDQ_TTZZ_SKRKHH") ? (String) centerPositionMap.get("DGDQ_TTZZ_SKRKHH") : "";
                    if (checkDepositBankName(tzzz_fkhh) && checkDepositBankName(tzzz_skhh)) {
                        hasBankName = true;
                    }
                }
            }
            //如果不包含三峡银行 终止任务
            if (!hasBankName) {
                terminate(workflowNumber, failReason, nodeLog);
                return AutoCompareEntity.error(failReason);
            }
        } else if (AspectFlag.AspectFlag2.equals(cps_flag) && SystemSource.TRANSFER_ACCOUNTS.equals(source)) {
            //来源是整单并且是转账
            boolean hasBankName = false;
            String zd_fkhmc = centerPositionMap.containsKey("ZD_FKRKHHMC") ? (String) centerPositionMap.get("ZD_FKRKHHMC") : "";//付款人开户行名称
            String zd_skhmc = centerPositionMap.containsKey("ZD_SKRKHHMC") ? (String) centerPositionMap.get("ZD_SKRKHHMC") : "";//收款人开户行名称
            if (checkDepositBankName(zd_fkhmc) && checkDepositBankName(zd_skhmc)) {
                hasBankName = true;
            }
            //如果不包含三峡银行 终止任务
            if (!hasBankName) {
                terminate(workflowNumber, failReason, nodeLog);
                return AutoCompareEntity.error(failReason);
            }
        }
        return AutoCompareEntity.ok();
    }

    /**
     * 定期存款、通知存款
     * 定期存款 比对业务代号 存期
     * 通知存款 比对业务代号
     *
     * @param needCompareFields
     * @param failReason
     * @param nodeLog
     * @return
     */
    private AutoCompareEntity compareBusinessCode(Map<String, String> needCompareFields, String failReason, String nodeLog) {
        BizDespositInfo despositInfo = null;
        if (register instanceof BizDespositInfo) {
            despositInfo = (BizDespositInfo) register;
            String bsty = despositInfo.getBsty();
            if (ServiceType.DQCK.getValue().equals(bsty)) {
                AutoCompareEntity autoCompareEntity = compareBasicEquals(needCompareFields, failReason, nodeLog);
                if (autoCompareEntity.getFlag()) {
                    String wcq = (String) netPositionMap.get("MATURITY");//存期
                    String interest = (String) netPositionMap.get("DEFINE_MATURITY");//自定义存期
                    String endday = (String) netPositionMap.get("SJCKTS");//到期日
                    //cq这里是归类的存期，后面调整
                    String cq = "";
                    String reason = "";
                    if ("%".equals(wcq) && "999".equals(interest)) {//自定义存期
                        if (!(endday + "天").equals(cq)) {
                            reason = "网点岗与中心岗录入的存期不符，系统自动终止";
                            terminate(workflowNumber, reason, "对公定期存款存期出错");
                            return AutoCompareEntity.error(reason);
                        }
                    } else if ("%".equals(wcq) && !("999".equals(interest))) {
                        if (!interest.equals(cq)) {
                            reason = "网点岗与中心岗录入的存期不符，系统自动终止";
                            terminate(workflowNumber, reason, "对公定期存款存期出错");
                            return AutoCompareEntity.error(reason);
                        }
                    }
                }
                return autoCompareEntity;
            } else if (ServiceType.TZCK.getValue().equals(bsty)) {
                return compareBasicEquals(needCompareFields, failReason, nodeLog);
            }
        }
        return AutoCompareEntity.ok();
    }

    /**
     * 定期存款、通知存款
     * 查询付款人&收款人 信息（这个业务逻辑有问题，待定）
     *
     * @param needCompareFields
     * @return
     */
    private AutoCompareEntity checkDepositAtNoticePayerAndPayeeInfo(Map<String, String> needCompareFields, String failReason, String nodeLog) {
        String source = netPositionMap.containsKey("SOURCE") ? (String) netPositionMap.get("SOURCE") : "";
        String skrmc = centerPositionMap.containsKey("USER_NAME") ? (String) centerPositionMap.get("USER_NAME") : "";//收款人名称
        String reason = "";
        if (SystemSource.PENDING_WRITE_OFF.getValue().equals(source)) {
            //当系统来源为待销帐
            String CUSTOMER_NAME = netPositionMap.containsKey("SOURCE") ? (String) netPositionMap.get("CUSTOMER_NAME") : "";//客户名
            if (!skrmc.equals(CUSTOMER_NAME)) {
                reason = "收款人名称中心录入为：" + skrmc + " ，核心为：" + CUSTOMER_NAME + "，比对不一致，系统自动终止";
                terminate(workflowNumber, reason, "收款人名称与核心不一致");
                return AutoCompareEntity.error(reason);
            }
            return AutoCompareEntity.ok();
        } else if (SystemSource.TRANSFER_ACCOUNTS.getValue().equals(source)) {
            //当系统来源为待销账
            //具体实现逻辑待定
            //String queryPayerResult = QueryPeyerMsgFromKernel.queryHNZZCCYFromKernel(skrmc, despositInfo, organId, fkrzh, fkrmc, "710306", acceptXml, tranPo);
            String queryPayerResult = "";
            if (!"pass".equals(queryPayerResult)) {
                reason = queryPayerResult + "，系统自动终止";
                terminate(workflowNumber, reason, "校验收/付款人信息出错");
                return AutoCompareEntity.error(reason);
            }
        }
        return AutoCompareEntity.ok();
    }

    /**
     * 保证金开户
     * 日期合法校验
     *
     * @param needCompareFields
     * @return
     */
    private AutoCompareEntity depositAtNoticeCheckDateLegal(Map<String, String> needCompareFields, String failReason, String nodeLog) {
        String reason = "";
        String source = netPositionMap.containsKey("SOURCE") ? (String) netPositionMap.get("SOURCE") : "";
        String cprq = centerPositionMap.containsKey("cprq") ? (String) centerPositionMap.get("cprq") : "";//出票日期
        //这里用register强向下转型为保证金登记薄类型，然后取出voucherType的值
        String voucherType = "";
        if (VoucherType.VOUCHERTYPE01.getValue().equals(voucherType) || VoucherType.VOUCHERTYPE38.getValue().equals(voucherType)) {
            //转账支票（清分机，非清分机），校验远期逾期
//            cprq = Exec_Util.translationForData(cprq, baseDao);调接口查，到时候具体在写业务
            cprq = "";
            if ("false".equals(cprq)) {
                reason = "大写日期录入出错，流程终止";
                terminate(workflowNumber, reason, "日期合法性检查出错");
                return AutoCompareEntity.error(reason);
            }
//            String dvRtnMsg = DateValidity.dateValidity(cprq, baseDao);调接口查，到时候具体在写业务
            String dvRtnMsg = "";
            if (!"pass".equals(dvRtnMsg)) {
                reason = dvRtnMsg + "，流程终止";
                terminate(workflowNumber, reason, "日期合法性检查出错");
                return AutoCompareEntity.error(reason);
            }
        } else if (VoucherType.VOUCHERTYPE71.getValue().equals(voucherType)) {
            //特种转账凭证与当前日期比较
            String currentDate = new SimpleDateFormat("yyyyMMdd").format(new Date());
            log.debug("【当前日期：" + currentDate + "】【出票日期：" + cprq + "】");
            if (!currentDate.equals(cprq)) {
                reason = "凭证日期不符，系统自动终止";
                terminate(workflowNumber, reason, "日期合法性检查出错");
                return AutoCompareEntity.error(reason);
            }
        }
        if (SystemSource.PENDING_WRITE_OFF.getValue().equals(source)) {
            SimpleDateFormat sf = new SimpleDateFormat("yyyyMMdd");
            String today = sf.format(new Date());//当前日期
            String rq = "";//map.get("rq")
            if (!today.equals(rq)) {
                reason = "待销账日期与当前日期比对不一致，系统自动终止";
                terminate(workflowNumber, reason, "待销账日期与当前日期比对不一致");
                return AutoCompareEntity.error(reason);
            }
        }
        return AutoCompareEntity.ok();
    }

    /**
     * 定期存款、通知存款
     * 业务判重
     *
     * @param needCompareFields
     * @return
     */
    private AutoCompareEntity cashDepositAtNoticeJudgmentRepetition(Map<String, String> needCompareFields, String failReason, String nodeLog) {
        //校验业务是否重复
        //重复发往网点确认
        return AutoCompareEntity.ok();
    }

    /**
     * 普通汇兑
     * 开户行验证
     *
     * @param needCompareFields
     * @param failReason
     * @param nodeLog
     * @return
     */
    private AutoCompareEntity ordinaryExchangeCheckBankName(Map<String, String> needCompareFields, String failReason, String nodeLog) {
        String fkhmc = centerPositionMap.containsKey("RECV_BNAME") ? (String) centerPositionMap.get("RECV_BNAME") : "";
        String voucherType = netPositionMap.containsKey("CERTY") ? (String) netPositionMap.get("CERTY") : "";
        String cps_flag = "";
        if (register instanceof BizExchangeInfo) {
            cps_flag = ((BizExchangeInfo) register).getCpsFlag();
        }
        if (!checkDepositBankName(fkhmc)) {
            terminate(workflowNumber, failReason, nodeLog);
            return AutoCompareEntity.error(failReason);
        }
//        if ((VoucherType.VOUCHERTYPE01.getValue().equals(voucherType) || VoucherType.VOUCHERTYPE38.getValue().equals(voucherType)) && AspectFlag.AspectFlag1.equals(cps_flag)) {
//            String JZD_FKHMC = centerPositionMap.containsKey("JZD_FKHMC") ? (String) centerPositionMap.get("JZD_FKHMC") : "";
//            if (!checkDepositBankName(JZD_FKHMC)) {
//                terminate(workflowNumber, failReason, nodeLog);
//                return AutoCompareEntity.error(failReason);
//            }
//        }
        return AutoCompareEntity.ok();
    }

    /**
     * 普通汇兑
     * 金额校验
     *
     * @param needCompareFields
     * @param failReason
     * @param nodeLog
     * @return
     */
    private AutoCompareEntity ordinaryExchangeCheckAmount(Map<String, String> needCompareFields, String failReason, String nodeLog) {
        String amount = netPositionMap.containsKey("AMOUNT") ? (String) netPositionMap.get("AMOUNT") : "";
        String je = centerPositionMap.containsKey("je") ? (String) centerPositionMap.get("je") : "";
        String center_amount = Exec_Util.addPoint(je);
        if (!center_amount.equals(amount)) {
            String reason = "网点录入金额：" + amount + "，中心录入金额：" + center_amount + failReason;
            terminate(workflowNumber, reason, nodeLog);
            return AutoCompareEntity.error(reason);
        }
        return AutoCompareEntity.ok();
    }

    /**
     * 普通汇兑
     * 账户类型为卡或一本通  校验网点的付款人名称、账号 和 中心付款人名称、账号是否一致
     *
     * @param needCompareFields
     * @param failReason
     * @param nodeLog
     * @return
     */
    private AutoCompareEntity ordinaryExchangePayerInfo(Map<String, String> needCompareFields, String failReason, String nodeLog) {
        String accty = netPositionMap.containsKey("ACCTY") ? (String) netPositionMap.get("ACCTY") : "";
        if (AccountType.AccountType1.getValue().equals(accty) || AccountType.AccountType2.getValue().equals(accty) || AccountType.AccountType9.getValue().equals(accty)) {
            String pay_name = netPositionMap.containsKey("PAY_NAME") ? (String) netPositionMap.get("PAY_NAME") : "";
            String fkrmc = centerPositionMap.containsKey("fkrmc") ? (String) centerPositionMap.get("fkrmc") : "";
            if (!fkrmc.equals(pay_name)) {
                String reason = "网点录入付款人名称：" + pay_name + "，中心录入付款人名称：" + fkrmc + "，比对不一致，系统自动终止";
                terminate(workflowNumber, reason, "网点岗与中心岗录入的付款人名称不符");
                return AutoCompareEntity.error(reason);
            }
            String payerAcNo = netPositionMap.containsKey("PAY_ACC") ? (String) netPositionMap.get("PAY_ACC") : "";
            String fkrzh = centerPositionMap.containsKey("fkrzh") ? (String) centerPositionMap.get("fkrzh") : "";
            if (!fkrzh.equals(payerAcNo)) {
                String reason = "网点录入付款人账号：" + payerAcNo + "，中心录入付款人账号：" + fkrzh + "，比对不一致，系统自动终止";
                terminate(workflowNumber, reason, "网点岗与中心岗录入的付款人账号不符");
                return AutoCompareEntity.error(reason);
            }
        }
        return AutoCompareEntity.ok();
    }

    /**
     * 普通汇兑
     * 当账号为对公账号时候通过外部系统查询付款人信息
     *
     * @param needCompareFields
     * @param failReason
     * @param nodeLog
     * @return
     */
    private AutoCompareEntity ordinaryExchangeSelectPayerInfo(Map<String, String> needCompareFields, String failReason, String nodeLog) {
        String accty = netPositionMap.containsKey("ACCTY") ? (String) netPositionMap.get("ACCTY") : "";
        if (AccountType.AccountType0.getValue().equals(accty)) {//对公账号时才验证
//            String queryResult = QueryPeyerMsgFromKernel.queryAcctyFromKernel(exchangeInfo,organId,fkrzh,fkrmc,acceptXml);//这里调用外部系统接口验证数据
            String queryResult = "";
            if (!"pass".equals(queryResult)) {
                String reason = queryResult + failReason;
                terminate(workflowNumber, reason, nodeLog);
                return AutoCompareEntity.error(reason);
            }
        }
        return AutoCompareEntity.ok();
    }

    /**
     * 普通汇兑
     * 日期合法性校验
     *
     * @param needCompareFields
     * @param failReason
     * @param nodeLog
     * @return
     */
    private AutoCompareEntity ordinaryExchangeCheckTime(Map<String, String> needCompareFields, String failReason, String nodeLog) {
        String voucherType = netPositionMap.containsKey("CERTY") ? (String) netPositionMap.get("CERTY") : "";
        String cprq = centerPositionMap.containsKey("cprq") ? (String) centerPositionMap.get("cprq") : "";//出票日期
        String accty = netPositionMap.containsKey("ACCTY") ? (String) centerPositionMap.get("ACCTY") : "";//账户类型
        if (VoucherType.VOUCHERTYPE01.getValue().equals(voucherType) || VoucherType.VOUCHERTYPE38.getValue().equals(voucherType)) {//转账支票（清分机，非清分机），校验远期逾期
//            cprq = Exec_Util.translationForData(cprq, baseDao);查询验证，后面来写
            cprq = "";
            if ("false".equals(cprq)) {
                String reason = "大写日期录入出错，流程终止";
                terminate(workflowNumber, reason, nodeLog);
                return AutoCompareEntity.error(reason);
            }
//            String dvRtnMsg = DateValidity.dateValidity(cprq, baseDao);
            String dvRtnMsg = "";
            if (!"pass".equals(dvRtnMsg)) {
                String reason = dvRtnMsg + "，流程终止";
                terminate(workflowNumber, reason, nodeLog);
                return AutoCompareEntity.error(reason);
            }
        } else if (VoucherType.VOUCHERTYPE18.getValue().equals(voucherType) || VoucherType.VOUCHERTYPE73.getValue().equals(voucherType) || AccountType.AccountType1.getValue().equals(accty) || AccountType.AccountType2.getValue().equals(accty)
                || VoucherType.VOUCHERTYPE71.getValue().equals(voucherType) || VoucherType.VOUCHERTYPE72.getValue().equals(voucherType)) {//电汇，支款凭条，特种转账凭证，卡，活期一本通
            String currentDate = new SimpleDateFormat("yyyyMMdd").format(new Date());
            log.info("【当前日期：" + currentDate + "】【出票日期：" + cprq + "】");
            if (!currentDate.equals(cprq)) {
                String reason = "日期不合法，系统自动终止";
                terminate(workflowNumber, reason, nodeLog);
                return AutoCompareEntity.error(reason);
            }
        }
        return AutoCompareEntity.ok();
    }

    /**
     * 普通汇兑
     * 核心验密
     *
     * @param needCompareFields
     * @param failReason
     * @param nodeLog
     */
    private AutoCompareEntity ordinaryExchangeCheckPassword(Map<String, String> needCompareFields, String failReason, String nodeLog) {
        String accty = netPositionMap.containsKey("ACCTY") ? (String) centerPositionMap.get("ACCTY") : "";//账户类型
        String wdmd = "";
        if (register instanceof BizExchangeInfo) {
            wdmd = ((BizExchangeInfo) register).getWdmd();
        }
        if ((accty.equals(AccountType.AccountType0.getValue()) || accty.equals(accty.equals(AccountType.AccountType9.getValue())) && wdmd.equals(com.sino.operation.commons.commonEnum.DrawMethod.DrawMethod1.getValue()))) {
            //账户类型为对公账户或账户类型为内部账户并且支取方式是凭密码
            String acct_branch_id = netPositionMap.containsKey("DEPT_ID") ? (String) centerPositionMap.get("DEPT_ID") : "";//营业机构号
            if (acct_branch_id == null || "".equals(acct_branch_id)) {
                acct_branch_id = ((BizExchangeInfo) register).getBusinessNo();
            }
//            String vpRtnMsg = VerifiPassword.verifiPassword(null, acceptXml, map);//调用核心验密接口
            String vpRtnMsg = "";
            if (!"pass".equals(vpRtnMsg)) {
                String reason = vpRtnMsg + failReason;
                terminate(workflowNumber, reason, nodeLog);
                return AutoCompareEntity.error(reason);
            }
        }
        return AutoCompareEntity.ok();
    }

    /**
     * 普通汇兑
     * 查询付款人信息
     *
     * @param needCompareFields
     * @param failReason
     * @param nodeLog
     * @return
     */
    private AutoCompareEntity ordinaryExchangeQueryPayerInfo(Map<String, String> needCompareFields, String failReason, String nodeLog) {
//        String queryPayerResult = QueryPayerMsgFromPaysys.queryPayerMsgFromPaysys(acceptXml, map, tranPo, exchangeInfo, xml);
        String queryPayerResult = "";
        if (!"pass".equals(queryPayerResult)) {
            String reason = queryPayerResult + failReason;
            terminate(workflowNumber, reason, nodeLog);
            return AutoCompareEntity.error(reason);
        }
        return AutoCompareEntity.ok();
    }

    /**
     * 行内转账
     * 开户行验证
     *
     * @param needCompareFields
     * @param failReason
     * @param nodeLog
     * @return
     */
    private AutoCompareEntity transferAccountsCheckBankName(Map<String, String> needCompareFields, String failReason, String nodeLog) {
        String fkhmc = centerPositionMap.containsKey("HNZZ_ZZZP_FKMC") ? (String) centerPositionMap.get("HNZZ_ZZZP_FKMC") : "";//付款行名称;
        String skrkhh = centerPositionMap.containsKey("skrkhh") ? (String) centerPositionMap.get("skrkhh") : "";
        String fkrkhh = centerPositionMap.containsKey("fkrkhh") ? (String) centerPositionMap.get("fkrkhh") : "";
        String voucherType = netPositionMap.containsKey("CERTY") ? (String) netPositionMap.get("CERTY") : "";
        String cps_flag = "";
        if (register instanceof BizExchangeInfo) {
            cps_flag = ((BizInternalTrans) register).getCpsFlag();
        }
        if ((VoucherType.VOUCHERTYPE01.getValue().equals(voucherType) || VoucherType.VOUCHERTYPE38.getValue().equals(voucherType)) && AspectFlag.AspectFlag1.equals(cps_flag)) {
            //行内转账付款行名称不跨单
            if (checkDepositBankName(fkhmc)) {
                terminate(workflowNumber, failReason, nodeLog);
                return AutoCompareEntity.error(failReason);
            }
        }
        if (checkDepositBankName(skrkhh)) {
            terminate(workflowNumber, failReason, nodeLog);
            return AutoCompareEntity.error(failReason);
        }
        if (checkDepositBankName(fkrkhh)) {
            terminate(workflowNumber, failReason, nodeLog);
            return AutoCompareEntity.error(failReason);
        }
        return AutoCompareEntity.ok();
    }

    /**
     * 行内转账
     * 查询付款人信息、币种
     *
     * @param needCompareFields
     * @param failReason
     * @param nodeLog
     * @return
     */
    private AutoCompareEntity transferAccountsQueryPayerInfo(Map<String, String> needCompareFields, String failReason, String nodeLog) {
//        String queryResult = QueryPeyerMsgFromKernel.queryHNZZCCYFromKernel("",internalTrans,organId,fkrzh,fkrmc,"710304",acceptXml,tranPo);
        String queryResult = "";
        if (!"pass".equals(queryResult)) {
            String reason = queryResult + failReason;
            terminate(workflowNumber, reason, nodeLog);
            return AutoCompareEntity.error(reason);
        }
        return AutoCompareEntity.ok();
    }

    /**
     * 行内转账
     * 查询付款人信息
     *
     * @param needCompareFields
     * @param failReason
     * @param nodeLog
     * @return
     */
    private AutoCompareEntity transferAccountsQueryPayeeInfo(Map<String, String> needCompareFields, String failReason, String nodeLog) {
//        String queryRecvResult = QueryPeyerMsgFromKernel.queryHNZZskrzh(acceptXml, skrzh, skrmc);
        String queryRecvResult = "";
        if (!"pass".equals(queryRecvResult)) {
            String reason = queryRecvResult + failReason;
            terminate(workflowNumber, reason, nodeLog);
            return AutoCompareEntity.error(reason);
        }
        return AutoCompareEntity.ok();
    }

    /**
     * 行内转账
     * 日期合法性校验
     *
     * @param needCompareFields
     * @param failReason
     * @param nodeLog
     * @return
     */
    private AutoCompareEntity transferAccountsCheckTime(Map<String, String> needCompareFields, String failReason, String nodeLog) {
        String voucherType = netPositionMap.containsKey("CERTY") ? (String) netPositionMap.get("CERTY") : "";
        String cprq = centerPositionMap.containsKey("cprq") ? (String) centerPositionMap.get("cprq") : "";//出票日期
        String accty = netPositionMap.containsKey("ACCTY") ? (String) centerPositionMap.get("ACCTY") : "";//账户类型
        if (VoucherType.VOUCHERTYPE01.getValue().equals(voucherType) || VoucherType.VOUCHERTYPE38.getValue().equals(voucherType)) {//转账支票（清分机，非清分机），校验远期逾期
//            cprq = Exec_Util.translationForData(cprq, baseDao);查询验证，后面来写
            cprq = "";
            if ("false".equals(cprq)) {
                String reason = "大写日期录入出错，流程终止";
                terminate(workflowNumber, reason, nodeLog);
                return AutoCompareEntity.error(reason);
            }
//            String dvRtnMsg = DateValidity.dateValidity(cprq, baseDao);
            String dvRtnMsg = "";
            if (!"pass".equals(dvRtnMsg)) {
                String reason = dvRtnMsg + "，流程终止";
                terminate(workflowNumber, reason, nodeLog);
                return AutoCompareEntity.error(reason);
            }
        } else if (VoucherType.VOUCHERTYPE71.getValue().equals(voucherType) || VoucherType.VOUCHERTYPE18.getValue().equals(voucherType)
                || VoucherType.VOUCHERTYPE73.getValue().equals(voucherType)) {
            //特种转账支票
            String currentDate = new SimpleDateFormat("yyyyMMdd").format(new Date());
            log.info("【当前日期：" + currentDate + "】【出票日期：" + cprq + "】");
            if (!currentDate.equals(cprq)) {
                String reason = "日期不合法，系统自动终止";
                terminate(workflowNumber, reason, nodeLog);
                return AutoCompareEntity.error(reason);
            }
        }
        return AutoCompareEntity.ok();
    }

    /**
     * 行内转账
     * 自动验密
     *
     * @param needCompareFields
     * @param failReason
     * @param nodeLog
     * @return
     */
    private AutoCompareEntity transferAccountsCheckPassword(Map<String, String> needCompareFields, String failReason, String nodeLog) {
        String voucherType = netPositionMap.containsKey("CERTY") ? (String) centerPositionMap.get("CERTY") : "";//凭证种类
        String wdmd = "";
        if (register instanceof BizExchangeInfo) {
            wdmd = ((BizExchangeInfo) register).getWdmd();
        }
        if (VoucherType.VOUCHERTYPE01.getValue().equals(voucherType) || VoucherType.VOUCHERTYPE38.getValue().equals(voucherType)) {
            //证件类型为转账支票，并且密码需要校验
            if ("1".equals(wdmd)) {
//                map.put("fhdm", internalTrans.getAcct_branch_id());
//                String vpRtnMsg = VerifiPassword.verifiPassword(xml, acceptXml, (HashMap) map);
                String vpRtnMsg = "";
                if (!"pass".equals(vpRtnMsg)) {
                    String reason = vpRtnMsg + failReason;
                    terminate(workflowNumber, reason, nodeLog);
                    return AutoCompareEntity.error(reason);
                }
            }
        }
        return AutoCompareEntity.ok();
    }

    private static boolean checkDepositBankName(String name) {
        if (StringUtils.isNotBlank(name)) {
            if (name.contains("三峡银行")) {
                return true;
            }
        }
        return false;
    }

    /**
     * 系统自动终止任务
     * workFlowNumber ： 工作流唯一id
     * terminalReson ： 终止原因
     */
    private void terminate(String flowId, String terminalReason, String logMsg) {
        Map map = taskTerminalUtil.taskTerminal(this.journalNo, flowId, "SYSTEM", "SYSTEM",
                "SYSTEM", terminalReason, ConstantValue.TERMINATE_SOURCE_SYSTEM);
        String code = map.get("code").toString();
        if (!"200".equals(code)) {
            log.error("!!!!!!!!!!!!严重错误!!!!!!!!!!!!" + logMsg + "，无法自动终止该任务，请在网点终止或及时联系管理员");
            throw new TerminalTaskException(CenterResponseEnum.TERMINAL_TASK_ERROR);
        }
    }

    /**
     * 查询自动节点配置信息
     *
     * @param transCode
     */
    private List<AutoCheck> handlerAutoCheckConfigList(String transCode) {
        QueryWrapper<AutoCheck> autoCheckQueryWrapper = new QueryWrapper<>();
        if (transCode != null && !transCode.equals("")) {
            autoCheckQueryWrapper.eq("TRANS_CODE", transCode);
        }
        return autoCheckService.list(autoCheckQueryWrapper);
    }

    /**
     * 查询登记薄信息
     *
     * @param transCode
     * @param <T>
     * @return
     */
    private <T extends Register> Register getRegister(String transCode, String journalNo) {
        Register register = null;
        switch (transCode) {
            case "710302":
                register = exchangeInfoService.getById(journalNo);
                break;
            case "710304":
                register = internalTransService.getById(journalNo);
                break;
            case "710305":
                register = marginOpenAccountService.getById(journalNo);
                break;
            case "710306":
                register = despositInfoService.getById(journalNo);
                break;
            default:
                break;
        }
        return register;
    }
}
